/*  Copyright 2010 Daniel Brasil Magnani
 *  Created on: Dec 20, 2010
 *      Author: daniel */

#ifndef CSP_INSTANCE_H_
#define CSP_INSTANCE_H_

#include <limits.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>

#include <algorithm>
#include <ctime>
#include <list>
#include <vector>

struct Constraint {
  int n;
  int p;
};

struct Car {
  int64_t identifier;
  float utilization_rate;
  int *constraints;
};

class Instance {
 public:
  // Singleton get method
  static Instance* get_instance();
  // Initialize the instance
  int Init(char *instance_name);
  // Write solution to output/
  // TODO(daniel) Mover para classe Solution!
  int WriteOutput(const std::vector<Car>& solution);
  // Retrieve the instance name
  char* get_instance_name();
  // Retrieve the paint batch limit
  int get_paint_batch_limit();
  // Retrieve the list of today cars
  const std::vector<Car>& get_today_cars();
  // Retrieve the list of yesterday cars
  const std::vector<Car>& get_yesterday_cars();
  // Retrieve the constraint list
  const std::vector<Constraint>& get_constraint_list();
 private:
  // Read paint_batch_limit.txt
  int ReadPaintInput();
  // Read ratios.txt
  int ReadConstraints();
  // Read vehicles.txt
  int ReadVehicles();
  // Forbidden operations for the singleton design pattern
  Instance() {}
  Instance(Instance const&) {}
  Instance& operator=(Instance const&) {}

  static Instance* instance;
  char instance_name_[256];
  int paint_batch_limit_;
  std::vector<Car> today_cars_;
  std::vector<Car> yesterday_cars_;
  std::vector<Constraint> constraint_list_;
};

#endif  // CSP_INSTANCE_H_
